package fivetech.dbaseII;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.os.Message;
import android.view.KeyEvent;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;

public class dBaseII extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ( ( EditText ) findViewById( R.id.editText1 ) ).setOnEditorActionListener( new OnEditorActionListener() {

			@Override
			public boolean onEditorAction(TextView v, int keycode,
					KeyEvent event) {
      	      if( event.getAction() == KeyEvent.ACTION_DOWN ) 
    	      {
    	          /*
      	    	  switch (keycode) 
    	          {
    	              case KeyEvent.KEYCODE_DPAD_CENTER:
    	              case KeyEvent.KEYCODE_ENTER:
    	                  MsgInfo( "enter" ); 
    	                  return true;
    	          }
    	          */
    	          MsgInfo( Integer.toString( keycode ) );
    	          return true;
    	      }

    	      return true;
			} } ); 
        }
    
    public void MsgInfo( String cMsg )
    {
        AlertDialog alertDialog = new AlertDialog.Builder( this ).create();
        alertDialog.setTitle( "Information" );
        alertDialog.setMessage( cMsg );
        Message TRUE = null;
		alertDialog.setButton( "OK", TRUE );
        
        alertDialog.show();     
    }    
   
}